package com.sc.nft.controller;

import cn.hutool.core.date.DateUtil;
import com.sc.nft.annotation.UserLogin;
import com.sc.nft.controller.request.IdRequest;
import com.sc.nft.entity.MallBanner;
import com.sc.nft.entity.vo.MallBannerVO;
import com.sc.nft.service.MallBannerService;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/mallBanner")
@Api(tags = "商城banner")
public class MallBannerController {

    private final MallBannerService mallBannerService;


//    @ApiOperation(value = "根据id获取数据", notes = "根据id获取数据", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
//    @PostMapping(value = "/getById", produces = MediaType.APPLICATION_JSON_VALUE)
//    @UserLogin
//    public Result<MallBannerVO> getById(@Valid @RequestBody IdRequest idRequest){
//        MallBanner mallBanner = mallBannerService.getById(idRequest.getId(),1);
//        MallBannerVO mallBannerVO = new MallBannerVO();
//        BeanUtil.copyProperties(mallBanner,mallBannerVO);
//        return Result.success(mallBannerVO);
//    }



    @ApiOperation(value = "获取列表", notes = "获取列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
    @UserLogin
    public Result<List<MallBannerVO>> list(@Validated @RequestBody IdRequest idRequest){
        return Result.success(mallBannerService.list(idRequest.getId(),1));
    }



}
